#!/bin/bash
log="${HOME}/logs/cron.log" 

if [ $# -ne 1 ]
then
  echo "Error at($(date)): No target specified" >> "${log}"
  exit
fi

target="$1"
# 清理全部命令行参数,否则会影响到ara-init-build-env脚本的执行
shift $#

(
  taskDesc="yocto ${target} building"
  echo "INFO $(date): start ${taskDesc}" >> "${log}" 

  cd "${HOME}/git_repo/poky"
  source oe-init-build-env
  bitbake ${target}

  echo "INFO $(date): end ${taskDesc}" >> "${log}"
)
